package com.tjsinfo.tjsoa.system.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;

import com.tjsinfo.tjsoa.common.DealString;
import com.tjsinfo.tjsoa.common.ToolKit;
import com.tjsinfo.tjsoa.system.vo.Files;
import com.tjsinfo.tjsoa.workflow.WorkFlowTemplate;

public class ProcessDeployAction extends Action {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		MessageResources message=getResources(request);
		//提交上传附件
		String fromFilePath=message.getMessage(request.getLocale(), "system.uploadFile.tempFilePath");
		String toFilePath = ToolKit.getProperties("com/tjsinfo/tjsoa/system/properties/systemResource.properties", this).getProperty("system.workflow.uploadFile");
		List<Files> fileList=DealString.fileCopyTofile(request, fromFilePath, toFilePath);
		WorkFlowTemplate workFlowTemplate = new WorkFlowTemplate();
		for (Files files : fileList) {
			workFlowTemplate.processDefinitionDeploy(toFilePath+files.getNewFileName());
		}
		return mapping.findForward("success");
	}
}
